package com.guchenbo.lssp.domain;

import com.fasterxml.jackson.annotation.JsonProperty;

public enum SessionState {
    /**
     * livy session state
     */
    @JsonProperty("not_started") NOT_STARTED("not_started", true),
    @JsonProperty("starting") STARTING("starting", true),
    @JsonProperty("recovering") RECOVERING("recovering", true),
    @JsonProperty("idle") IDLE("idle", true),
    @JsonProperty("running") RUNNING("running", true),
    @JsonProperty("busy") BUSY("busy", true),
    @JsonProperty("shutting_down") SHUTTING_DOWN("shutting_down", false),
    @JsonProperty("error") ERROR("error", false),
    @JsonProperty("dead") DEAD("dead", false),
    @JsonProperty("killed") KILLED("killed", false),
    @JsonProperty("success") SUCCESS("success", false);

    private final String state;
    private final boolean isActive;

    SessionState(String state, boolean isActive) {
        this.state = state;
        this.isActive = isActive;
    }

    public String getState() {
        return state;
    }

    public boolean isActive() {
        return isActive;
    }
}
